package 选课系统;


public class Student extends People{
	public Student(String id,String name ,String sex) {
		super(id,name,sex);
	}
	
	//学生选课
	public boolean addCourse(Course courses) {
		boolean flag = false;
		for(int i = 0;i<People.courses.length;) {
			courses.addStudent(this);
			flag = true;
			break;
		}
		return flag;
	}
	
	//学生退课
	public boolean removeCourse(Course courses) {
		boolean flag = false;
		for(int i = 0;i<People.courses.length;) {
			courses.removeStudent(this);
			flag = true;
			break;	
		}
		return flag;
	}
	
	//显示学生选的课
	public void displayCourse() {
		System.out.println(this.name+"的课程表：");
		for(Course c:courses) {
			if(c !=null) {
				System.out.println(c.getCourse_id()+" "+c.getCourse_name()+" "+c.getCourse_where()+" "+c.getCourse_time());
			}
		}
		
	}
	

}
/*
public class Student {
	//public Student(String student_id,String student_name,String student_sex) 
	public String student_id;
	public String student_name;
	public String student_sex;
	public String major;
	public Course[] courses;
	
	 
	//构造函数
	public Student() {
		courses = new Course[1];
	}
	public Student(String student_id,String student_name,String student_sex) {
		this.student_id = student_id;
		this.student_name = student_name;
		this.student_sex = student_sex;
		courses = new Course[1];
	}
	public Student(String student_id,String student_name,String student_sex,String major) {
		this.student_id = student_id;
		this.student_name = student_name;
		this.student_sex = student_sex;
		this.major = major;
		courses = new Course[1];
	}
	
	
	//获取属性id，name，sex，major
	//获取id
	public String getStudent_id() {
		return student_id;
	}
	public void setStudent_id(String student_id) {
		this.student_id = student_id;
	}
	
	//获取name
	public String getStudent_name() {
		return student_name;
	}
	public void setStudent_name(String student_name) {
		this.student_id = student_name;
	}
	
	//获取sex
	public String getStudent_sex() {
		return student_sex;
	}
	public void setStudent_sex(String student_sex) {
		this.student_sex = student_sex;
	}
	
	//获取major
	public String getMajor() {
		return major;
	}
	public void setMajor(String major) {
		this.major = major;
	}
*/	

